#pragma once
#include<vector>


void Swap1(int& a, int& b)
{
	int tmp = a;
	a = b;
	b = tmp;
}

void BubbleSort(std::vector<int>& nums)
{
	int n = nums.size();
	for (int i = 0; i < n; i++)
	{
		bool exchange = false;
		for (int j = 1; j < n - i; j++)
		{
			if (nums[j - 1] > nums[j])
			{
				Swap1(nums[j - 1], nums[j]);
				exchange = true;
			}
		}

		if (!exchange) break;
	}
}